/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package action.organization;

import com.opensymphony.xwork2.ActionSupport;
import javax.servlet.http.HttpServletRequest;
import org.apache.struts2.interceptor.ServletRequestAware;
import po.Organization;
import service.OrgService;
import myUtils.Constants;

/**
 *
 * @author luyang
 */
public class AddOrgAction extends ActionSupport implements ServletRequestAware
{
    private HttpServletRequest request;
    private OrgService orgService;
    private Organization organization;

    @Override
    public String execute()
    {
        //organization.setName("test");
        organization.setType(Constants.UNCHECKED_ORG);
        orgService.addOrg(organization);
        request.setAttribute("msg", "Success submited!Waiting for checked!");
        System.out.println(request.getAttribute("msg"));
        return SUCCESS;
    }

    public void setOrganization(Organization organization)
    {
        this.organization=organization;
    }

    public void setOrgService(OrgService orgService)
    {
        this.orgService=orgService;
    }

    public void setServletRequest(HttpServletRequest request)
    {
        this.request=request;
    }

}
